package com.unit_12;
public class PriorityQueue { 
    public static void main(String[] args) {
        int[] ia = {1, 5, 3, 7, 6, 9, 8};
        java.util.PriorityQueue<Integer> pq = new java.util.PriorityQueue<>();
        for (int x : ia)
            pq.offer(x); // 将数组元素插入优先队列
        while (!pq.isEmpty()) {
            System.out.print(pq.poll() + "  "); // 输出：1  3  5  6  7  8  9
        }
    }
}
